﻿Imports System.IO
Imports System.Windows.Markup

Module WPFHelper
	Public Sub SetResources(ByVal c As Control, ByVal resource As String)
		If resource = String.Empty Then
			c.Resources = Nothing
			Exit Sub
		End If
		Dim sr As New StringReader(resource)
		Dim xr = Xml.XmlReader.Create(sr)
		c.Resources.MergedDictionaries.Clear()
		c.Resources = XamlReader.Load(xr)
	End Sub
End Module
